<%@ Page Language="VB" MasterPageFile="~/site.master" AutoEventWireup="false" codefile="LeagueTable.aspx.vb" Inherits="LeagueTable" %>    
<asp:Content ID="Content1" ContentPlaceHolderID="mainContent" Runat="server">

    <asp:sqldatasource id="SqlDataSource1" runat="server" selectcommand="SELECT [Won]+[Drawn]+[Lost] AS [Played],[OpponentID], [Name], [Won], [Drawn], [Lost], [TotalGoalsFor], [TotalGoalsAgainst], [Points],[TotalGoalsFor]- [TotalGoalsAgainst] AS [GoalDifference] FROM [Opponents] Order By [Points] DESC, [GoalDifference] DESC, [TotalGoalsFor] DESC"
        connectionstring="<%$ ConnectionStrings:WroxUnited %>"></asp:sqldatasource>
        
    <asp:gridview id="GridView1" runat="server" datakeynames="OpponentID" datasourceid="SqlDataSource1"
        emptydatatext="There are no data records to display." autogeneratecolumns="False"
        allowpaging="True" allowsorting="False">
        <Columns>
            <asp:CommandField ShowSelectButton="False"></asp:CommandField>
            <asp:BoundField ReadOnly="True" HeaderText="OpponentID" DataField="OpponentID" SortExpression="OpponentID" Visible="False"></asp:BoundField>
            <asp:BoundField HeaderText="Name" DataField="Name" SortExpression="Name"></asp:BoundField>
            <asp:BoundField HeaderText="Played" DataField="Played" SortExpression="Played"></asp:BoundField>
            <asp:BoundField HeaderText="Won" DataField="Won" SortExpression="Won"></asp:BoundField>
            <asp:BoundField HeaderText="Drawn" DataField="Drawn" SortExpression="Drawn"></asp:BoundField>
            <asp:BoundField HeaderText="Lost" DataField="Lost" SortExpression="Lost"></asp:BoundField>
            <asp:BoundField HeaderText="TotalGoalsFor" DataField="TotalGoalsFor" SortExpression="TotalGoalsFor"></asp:BoundField>
            <asp:BoundField HeaderText="TotalGoalsAgainst" DataField="TotalGoalsAgainst" SortExpression="TotalGoalsAgainst"></asp:BoundField>
            <asp:BoundField HeaderText="Points" DataField="Points" SortExpression="Points"></asp:BoundField>
        </Columns>
    </asp:gridview>

</asp:Content>
